package cn.itsource.basic.controller;

import cn.itsource.basic.dto.UserSmsCodeDto;
import cn.itsource.basic.service.IVerifyCodeService;
import cn.itsource.basic.util.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {

    @Autowired
    IVerifyCodeService verifyCodeService;

    @PostMapping("sendSmsCode")
    public AjaxResult sendCode(@RequestBody UserSmsCodeDto userSmsCodeDto){
        verifyCodeService.sendCode(userSmsCodeDto);
        return AjaxResult.me();
    }

    @GetMapping("/image/{uuid}")
    public AjaxResult getCode(@PathVariable("uuid") String uuid){
        return verifyCodeService.genterateImgCode(uuid);
    }
}
